<template>
  <div class="app">
    <h2>Vue路由测试</h2>
    <!--导航区-->
    <div class="navigate">
      <RouterLink to="/home" class="active">首页</RouterLink>
      <RouterLink to="/news" class="active">新闻</RouterLink>
      <RouterLink to="/about" class="active">关于</RouterLink>
    </div>
    <!--展示区-->
    <div class="main-content">
      <RouterView></RouterView>
    </div>
  </div>
</template>


<script setup lang="ts">
  import { RouterView,RouterLink } from 'vue-router';
</script>



<style scoped>
/* 通用样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background-color: #f4f4f4;
  color: #333;
}

.app {
  width: 80%;
  margin: 20px auto;
}

/* 标题样式 */
h2 {
  text-align: center;
  font-size: 24px;
  color: #444;
  margin-bottom: 20px;
}

/* 导航区样式 */
.navigate {
  text-align: center;
  margin-bottom: 20px;
}

.navigate a {
  text-decoration: none;
  color: #007BFF;
  font-size: 18px;
  margin: 0 15px;
  padding: 10px;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

.navigate a:hover {
  background-color: #007BFF;
  color: white;
}

/* 展示区样式 */
.main-content {
  padding: 20px;
  background-color: #fff;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-height: 200px; /* 保证展示区有一定高度 */
}

.main-content p {
  font-size: 16px;
  line-height: 1.6;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .app {
    width: 95%;
  }

  .navigate {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
  }

  .navigate a {
    margin: 10px 15px;
    font-size: 16px;
  }

  .main-content {
    padding: 15px;
  }
}
</style>